package com.day12.study.netcode_demo;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class IPDemo {
    public static void main(String[] args) {
        InetAddress[] address = new InetAddress[0];
        try {
            address = InetAddress.getAllByName("www.baidu.com");
        } catch (
                UnknownHostException e) {
            e.printStackTrace();
        }
        for (InetAddress ia : address) {
            System.out.println(ia.getHostName());
            System.out.println(ia.getHostAddress());
            System.out.println();
        }
    }
}
